<%= form_for(@bill,:remote => true) do |f| %>
  <% if @bill.errors.any? %>
    <div id="error_explanation">
      <ul>
        <% @bill.errors.full_messages.each do |msg| %>
          <li><%= msg %></li>
        <% end %>
      </ul>
    </div>
  <% end %>

  <%= load_sold_template(f,:solds) %>
  <div class="field">
    <%= f.label :customer_id %>
    <%= f.select(:customer_id,Person.customers.collect {|p| [ p.name, p.id ] }, {:include_blank => true}) %>
  </div>
  <div class="field">
    <%= f.label :on_date %>
    <%= f.text_field :on_date,:size => 8,:class=>"date" %>
  </div>
  <div class="field">
    <%= f.label :electrician_id %>
    <%= f.select(:electrician_id,Person.electricians.collect {|p| [ p.name, p.id ] }, {:include_blank => true}) %>
  </div>

  <%= f.hidden_field :is_cash_bill,:value=>'true' %>

  <%= render 'bills/bill_sold_table',:f=>f %>

  <div class="field">
    <%= f.label :total_amount %>
    <%= f.text_field :total_amount,:readonly=>true,:class=>"grand_total" %>
  </div>
  <div class="actions">
    <%= f.submit "Save" %>
    <%= f.submit "Save&Print" %>
  </div>
<% end %>
